﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace PRE.Report_Catalog
{
    public partial class FrmThongke_hv_theolop : DevExpress.XtraEditors.XtraForm
    {
        DAL.EntitesDAL.KhoahocDAL _dal1 = new DAL.EntitesDAL.KhoahocDAL();
        DAL.EntitesDAL.LophocDAL _dal2 = new DAL.EntitesDAL.LophocDAL();

        public FrmThongke_hv_theolop()
        {
            InitializeComponent();
        }

        private void FrmThongke_hv_theolop_Load(object sender, EventArgs e)
        {
            DataTable dtb1 = _dal1.Select();
            cboKhoahoc.Properties.DataSource = dtb1;

            cboKhoahoc.ItemIndex = -1;
        }

        private void cboKhoahoc_EditValueChanged(object sender, EventArgs e)
        {
            cboLophoc.Properties.ReadOnly = false;
            string _makhoa = cboKhoahoc.EditValue + "";
            DataTable dtb2 = _dal2.Select(_makhoa);
            cboLophoc.Properties.DataSource = dtb2;

            cboLophoc.ItemIndex = -1;
        }

        private void cboLophoc_EditValueChanged(object sender, EventArgs e)
        {
            string _makhoa = cboKhoahoc.EditValue + "";
            string _malop = cboLophoc.EditValue + "";

            DataTable tmp = _dal2.Select(_makhoa, _malop);
            if (tmp != null)
                grcMain.DataSource = tmp;
        }
    }
}